package dk.kapetanovic.jaft.transaction.fac;

import dk.kapetanovic.jaft.exception.TransactionException;
import dk.kapetanovic.jaft.log.JournalImpl;
import dk.kapetanovic.jaft.transaction.Transaction;
import dk.kapetanovic.jaft.transaction.TransactionImpl;
import dk.kapetanovic.jaft.transaction.TransactionManager;

public class DefaultTransactionFactory implements TransactionFactory {
	
	private TransactionManager tm;

	public DefaultTransactionFactory(TransactionManager tm) {
		this.tm = tm;
	}

	public DefaultTransactionFactory() {}

	@Override
	public Transaction createTransaction() throws TransactionException {
		return new TransactionImpl(tm, new JournalImpl());
	}

	@Override
	public void setTransactionManager(TransactionManager tm) {
		this.tm = tm;
	}
}
